package cn.com.huzo.repository.workflow.impl;

import cn.com.huzo.model.entities.workflow.ApprovalRuleMrpEntity;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import java.util.List;
import org.springframework.stereotype.Repository;
import cn.com.huzo.repository.workflow.ApprovalRuleMrpRepository;
import java.util.Map;

/**
 * 调达表审核规则数据访问对象。
 *
 * @author 吴旭
 */
@Repository("ApprovalRuleMrpRepository")
public class ApprovalRuleMrpRepositoryImpl extends GenericRepositoryImpl<ApprovalRuleMrpEntity, Long>
        implements ApprovalRuleMrpRepository {

    private final String namespace = "cn.com.huzo.repository.workflow.ApprovalRuleMrpRepository";

    /**
     * 构造函数,设置the entity to ApprovalRuleMrpRepositoryImpl.class.
     */
    public ApprovalRuleMrpRepositoryImpl() {
        super(ApprovalRuleMrpEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer fetchForCount(Map<String, Object> criterion) {
        return getSqlSession().selectOne(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchForCount"), criterion);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<ApprovalRuleMrpEntity> fetchForPage(Map<String, Object> criterion) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchForPage"), criterion);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchInsert(List<ApprovalRuleMrpEntity> itemList) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchInsert"), itemList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchUpdate(List<ApprovalRuleMrpEntity> itemList) {
        return getSqlSession().update(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchUpdate"), itemList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer delete(Long key) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "delete"), key);
    }
}
